package top.serms.leetcode;

/**
 * @Author: SerMs
 * @Date: 2023/09/27 15 14
 * @Email: 1839928782@qq.com
 * @Blog: https://serms.top
 * https://leetcode.cn/problems/palindrome-number/description/
 **/
public class Code09_Solution {
    public static boolean isPalindrome(int x) {
        if (x < 0) {
            return false;
        }
        if (x == 0) {
            return true;
        }                   
        int original = x;
        int reversed = 0;
        while (x != 0) {
            reversed = reversed * 10 + x % 10;
            x /= 10;
        }
        return reversed == original;
    }

    public static void main(String[] args) {
        int a = 0;
        System.out.println(isPalindrome(a));
    }
}
